<?
#include("../../db_connect.php");
class ChartsManager{

	var $series = array();
	var $nSeries = 0;
	var $seriesLength = 12;

	
	function PushSerie($serie){
		array_push($this->series,$serie);
		$this->nSeries++;
	}
	
	function PrintJSArray(){	
	$x = 0;
	$arrays = "";
		while($x< $this->seriesLength){
		$y =0;
		$line = "";
			while($y < $this->nSeries){	
				if($this->series[$y][$x]->Render() != NULL)
					$line .= $this->series[$y][$x]->Render().", ";
				$y++;
			}
			$line = substr($line, 0, -2);
			$arrays .= "{" .$line. "},";				
			$arrays .= " \n";
			$x++;
		}#end While X
		echo substr($arrays,0,-3);
	}#end PrintJSArray
	
}#end ChartsManager

class ChartSerieValue{
	var $label;
	var $value;
	
	function ChartSerieValue($label, $value){
		$this->label = $label;
		$this->value = $value;
	}
		
	function Render(){
	
	if(is_int($this->value)){
		if($this->value != 0)
				return $this->label." ".$this->value;
		else 
			return NULL;
	}else{
			if($this->value != "")
				return $this->label." ".$this->value;
		else 
			return NULL;
	}

	/*
		if($this->value != "")
				return $this->label." ".$this->value;
		else 
			return NULL;
			*/
	}
}#end ChartSerieValue

class ChartSerie{
	var $serie = array();
	
	function AddValue($label, $value){
		array_push($this->serie, new ChartSerieValue($label, $value));
	}

}

?>